package com.dongdong.service;

import com.dongdong.mapper.TAdminMapper;
import com.dongdong.model.TAdmin;
import com.dongdong.model.TAdminExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminServiceImpl implements AdminService{

    @Autowired
    private TAdminMapper tAdminMapper;


    @Override
    public TAdmin selectAdminByUsername(String username) {
        TAdminExample example = new TAdminExample();
        example.createCriteria().andUsernameEqualTo(username);
        List<TAdmin> tbAdmins=tAdminMapper.selectByExample(example);

        if(tbAdmins!=null && tbAdmins.size()>0){
            return tbAdmins.get(0);
        }
        return null;
    }
}
